package com.yao.longhan.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.yao.longhan.model.StoryArticle;
import com.yao.longhan.net.download.DownloadInfo;

import com.yao.longhan.dao.StoryArticleDao;
import com.yao.longhan.dao.DownloadInfoDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig storyArticleDaoConfig;
    private final DaoConfig downloadInfoDaoConfig;

    private final StoryArticleDao storyArticleDao;
    private final DownloadInfoDao downloadInfoDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        storyArticleDaoConfig = daoConfigMap.get(StoryArticleDao.class).clone();
        storyArticleDaoConfig.initIdentityScope(type);

        downloadInfoDaoConfig = daoConfigMap.get(DownloadInfoDao.class).clone();
        downloadInfoDaoConfig.initIdentityScope(type);

        storyArticleDao = new StoryArticleDao(storyArticleDaoConfig, this);
        downloadInfoDao = new DownloadInfoDao(downloadInfoDaoConfig, this);

        registerDao(StoryArticle.class, storyArticleDao);
        registerDao(DownloadInfo.class, downloadInfoDao);
    }
    
    public void clear() {
        storyArticleDaoConfig.clearIdentityScope();
        downloadInfoDaoConfig.clearIdentityScope();
    }

    public StoryArticleDao getStoryArticleDao() {
        return storyArticleDao;
    }

    public DownloadInfoDao getDownloadInfoDao() {
        return downloadInfoDao;
    }

}
